package com.zxk28.sqlbuilders;

public class SQLDeleteBuilder {
	private String prefix = "DELETE FROM ";
	private String table = null;
	private String whereClause = null;

	public SQLDeleteBuilder setDeleteTable(String table) {
		this.table = table;

		return this;
	}

	public SQLDeleteBuilder setWhereClause(String where) {
		this.whereClause = " WHERE " + where;

		return this;
	}

	public String getCmd() {
		if (table == null)
			return null;

		String cmd = prefix + table;

		if (whereClause != null)
			cmd += whereClause;
		cmd += ";";

		return cmd;
	}
	
	@Override
	public String toString() {
		return getCmd();
	}
}
